import config from "./config";
//封装http请求，返回一个promise对象
function http(params) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: config.baseUrl+params.url,
      data:{
        showapi_appid:config.showapi_appid,
        showapi_sign:config.showapi_sign,
        ...params.data
      },
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })

  })
}

export { http }